#ifndef NODEITEM_H
#define NODEITEM_H

#include<QGraphicsItem>
#include<QGraphicsTextItem>
#include<QtGui>
#include<QGraphicsProxyWidget>
#include<QList>
#include<QDataStream>

#include"node_content.h"
#include"node_socket.h"
#include"test.h"
#include"item_enum.h"
//#include "corefunctionwidget.h"

class NodeItem : public QGraphicsItem
{
public:
    NodeItem();
    NodeItem(QString title);
    NodeItem(const NodeItem &nodeItem);
    void operator=(const NodeItem &nodeItem);
    ~NodeItem();
    int type() const override {return Type_NodeItem;}


    void paint(QPainter *painter, const QStyleOptionGraphicsItem *option, QWidget *widget) override;
    QRectF boundingRect()const override;
    void SetTitle(QString title);

public:
//    friend QDataStream &operator<<(QDataStream &,const NodeItem &);
//    friend QDataStream &operator>>(QDataStream &,NodeItem &);




public:
    QString title;
    QColor *title_color;
    QGraphicsTextItem *text;
    QGraphicsProxyWidget *proxyContent;  //嵌入的widget
    NodeContent *content;


private:
    float width = 180; // 节点大小
    float title_height = 24;
    float height = 240;
    float edge_size = 10.0;



};

#endif // NODEITEM_H
